package data;

import java.util.Date;
import java.util.Iterator;
import java.util.TreeMap;

public class EdgeMap extends TreeMap<Location,Edge>{

	public EdgeMap (TraceMap tm){
		Iterator<Date> itTm = tm.descendingKeySet().iterator();
		Location oldLoc = null;
		Date oldT = null;
		while (itTm.hasNext()){
			Date t = itTm.next();
			Location loc = tm.get(t);
			if (oldLoc != null){
				Edge ed = new Edge(oldLoc, loc, oldT.getTime()-t.getTime());
				this.put(oldLoc, ed);
			}
			oldT = t;
			oldLoc = loc;
		}
	}
	public EdgeMap (){
		super();
	}
	
}
